package com.xzx.mr.index;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @author xinzhixuan
 * @version V1.0
 * @date 2019/8/9 21:37
 */
public class TwoIndexMapper extends Mapper<LongWritable, Text, Text, Text> {

    private Text k = new Text();
    private Text v = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        // atguigu--a.txt\t3
        String line = value.toString();
        String[] split = line.split("--");
        k.set(split[0]);
        v.set(split[1]);
        context.write(k, v);
    }
}
